﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;

namespace NielsDerdaele.HttpSocket.Phone {
    public class HttpClientStream : Stream {
        private HttpClientSocket socket;
        public HttpClientStream(HttpClientSocket socket) {
            this.socket = socket;
        }
        public override bool CanRead {
            get { return true; }
        }
        public override bool CanSeek {
            get { return false; }
        }
        public override bool CanWrite {
            get { return true; }
        }
        public override void Flush() {
            socket.Flush();
        }
        public override long Length {
            get { throw new NotSupportedException(); }
        }
        public override long Position {
            get {
                throw new NotSupportedException();
            }
            set {
                throw new NotSupportedException();
            }
        }
        public override int Read(byte[] buffer, int offset, int count) {
            return socket.Read(buffer, offset, count);
        }
        public override long Seek(long offset, SeekOrigin origin) {
            return 0;
        }
        public override void SetLength(long value) { }
        public override void Write(byte[] buffer, int offset, int count) {
            socket.Write(buffer, offset, count);
        }
    }
}
